import React, { Component } from 'react'

function A (props,ref){
  console.log(props,ref)
  props.onClick()
  return <div ref={ref}>A:{props.words}</div>
}

const NewA = React.forwardRef(A)
export default class App extends Component {
  Aref = React.createRef()
  componentDidMount(){
    console.log(this.Aref)
  }
  render() {
    return (
      <div>

        <NewA ref={this.Aref} words='sdasdasd' onClick={
          ()=>{
            console.log(this.Aref)
          }
        }
        />
      </div>
    )
  }
}

